<?php
function callLevel($data, $id="") {
    echo "<select id='slLevel' name='slLevel'>";
            if($data === "empty")
                echo "<option>$data</option>";
            else {
                if($id!="") {
                    foreach($data as $item) {
                        if($item["level_id"]==$id)
                            echo "<option value='".$item["level_id"]."' selected='selected'>$item[level_name]</option>";
                        else
                            echo "<option value='".$item["level_id"]."'>$item[level_name]</option>";
                    }
                }else {
                    foreach($data as $item) {
                        echo "<option value='".$item["level_id"]."'>$item[level_name]</option>";
                    }
                }
            }
    echo "</select>";
}
?>